package com.unknow.first.dapp.admin.account.controller.admin;

import com.lianziyou.chain.common.api.CommonResult;
import com.unknow.first.dapp.admin.account.service.AddressAccountDetailService;
import com.unknow.first.dapp.admin.account.service.AddressWithdrawService;
import com.unknow.first.dapp.admin.account.vo.WithDrawAuthVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.cloud.annotation.AuthLog;
import org.cloud.annotation.MfaAuth;
import org.cloud.annotation.SystemResource;
import org.cloud.constant.CoreConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admin/address/account/detail")
@Slf4j
@SystemResource(path = "/admin/address/account/detail")
@Api(value = "管理员：资金明细接口", tags = "管理员：资金明细接口")
public class AdminAddressAccountDetailController {

    @Autowired
    AddressAccountDetailService addressAccountDetailService;
    @Autowired
    private AddressWithdrawService addressWithdrawService;

    @SystemResource(value = "/authWithdraw", description = "管理员后台提现审核", authMethod = CoreConstant.AuthMethod.BYUSERPERMISSION)
    @PostMapping(value = "/authWithdraw")
    @AuthLog(bizType = "addressAccount.authWithdraw", desc = "管理员后台提现审核")
    @MfaAuth
    @ApiOperation("管理员:后台提现审核")
    public CommonResult<?> authWithdraw(@RequestBody WithDrawAuthVo withDrawAuthVo) throws Exception {

        return addressWithdrawService.adminAudit(withDrawAuthVo.getId(), withDrawAuthVo.getIsPass(), withDrawAuthVo.getRemark());
    }

}
